﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace dpdw.CompoundPattern
{
    /// <summary>
    /// 标准的绿头鸭
    /// </summary>
    public class MallardDuck : IQuackable, IQuackObservable
    {
        Observable observable;

        public MallardDuck()
        {
            observable = new Observable(this);
        }

        public void Quack()
        {
            System.Diagnostics.Trace.WriteLine("MallardDuck Quack");
            NotifyObservers();
        }

        public void RegisterObserver(Observer observer)
        {
            observable.RegisterObserver(observer);
        }

        public void NotifyObservers()
        {
            observable.NotifyObservers();
        }
    }
}
